<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<title>コントロールパネル</title>
		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<script src="assets/scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		<script src="assets/scripts/table.js" type="text/javascript"></script>
		<script type="text/javascript" src="./tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
		<script type="text/javascript" src="./assets/scripts/editor.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.datepicker.js"></script>
		<link type="text/css" href="./assets/styles/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
		<script type="text/javascript" src="./assets/scripts/ui/ui.core.js"></script>
		
		<script type="text/javascript">
		$(function() {

			$('.message').fadeIn("slow");
			$('.btn_regist').click(function(){
				if( confirm('登録してよろしいですか？') ){
					document.fm.mode.value = 'input';
					document.fm.submit();
				}
			});
			$('.btn_update').click(function(){
				if( confirm('更新してよろしいですか？') ){
					document.fm.mode.value = 'input';
					document.fm.submit();
				}
			});
			$('.btn_return').click(function(){
				location.href = "user_index.php?hist=2";
			});
			
			$('.auth').change(function(){
				if (this.value == 4) {
					$('#tr_op4')['show']();
					$('#tr_op9')['hide']();
					$('#fm [name=electric_id]').val("");
				}else	if  (this.value == 9) {
					$('#tr_op9')['show']();
					$('#tr_op4')['hide']();
					$('#fm [name=ins_co_cd]').val("");
					}
				else {
						$('#fm [name=ins_co_cd]').val("");
						$('#fm [name=electric_id]').val("");
						$('#tr_op4')['hide']();
						$('#tr_op9')['hide']();
				}
			});
		});
		</script>
	</head>
	<body id="">
{{ $menu }}
{{ $logout }}
		<div id="container"><div class="wrapper">
			<h2>ログインマスター管理</h2>
			<ul class="submenu clearfix">
				<li><a href="user_index.php">ユーザー情報一覧</a></li>
				<li>ユーザー情報登録</li>
				<li><a href="user_import.php">CSV更新</a></li>
			</ul>
			<h3>ユーザー情報{{ if $forms.id == '' }}登録{{ else }}更新{{ /if }}{{ if $phase == 'complete' }}完了{{ /if }}</h3>
{{ if $phase == 'input' }}
			<p class="message">内容を確認し、{{ if $forms.id == '' }}登録{{ else }}更新{{ /if }}ボタンをクリックしてください。</p>
			<form name="fm" id="fm" action="user_form.php" method="post">
				<table class="formTable">
					<tbody>
{{ if $forms.id != '' }}
						<tr>
							<th>更新日時</th>
							<td>
								{{ $forms.u_time|date_format:"%Y/%m/%d %H:%M" }}<input type="hidden" name="u_time" value="{{ $forms.u_time }}" />
							</td>
						</tr>
						<tr>
							<th>更新者</th>
							<td>
								{{ $forms.m_user_name }}<input type="hidden" name="m_user_name" value="{{ $forms.m_user_name }}" />
							</td>
						</tr>
						<tr>
							<th>ID</th>
							<td>
								{{ $forms.id }}
							</td>
						</tr>
{{ /if }}

						<tr>
							<th>※ログインID</th>
							<td>
								<input type="text" name="login_id" class="text" value="{{ $forms.login_id|escape }}"  maxlangth="20" />{{ $err.login_id }}
							</td>
						</tr>

						<tr>
							<th>※パスワード</th>
							<td>
								<input type="text" name="login_pwd" class="text" value="{{ $forms.login_pwd|escape }}"  maxlangth="20" />{{ $err.login_pwd }}
							</td>
						</tr>

						<tr>
							<th>※ユーザ名</th>
							<td>
								<input type="text" name="user_name" class="text" value="{{ $forms.user_name|escape }}"  maxlangth="100" />{{ $err.user_name }}
							</td>
						</tr>

						<tr>
							<th>※権限</th>
							<td>
{{ html_options name='auth' class = "auth" options=$auth selected=$forms.auth }}{{ $err.auth }}
							</td>
						</tr>
						<tr id = "tr_op4"  style="display: {{$ins_co_display}};">
							<th>※折込会社</th>
							<td>
{{ html_options name='ins_co_cd' options=$ins_co selected=$forms.ins_co_cd }}{{ $err.ins_co_cd }}
							</td>
						</tr>
<tr id = "tr_op9"  style="display: {{$electric_display}};">
							<th>※電波圏</th>
							<td>
{{ html_options name='electric_id' options=$electric selected=$forms.electric_id }}{{ $err.electric_id }}
							</td>
						</tr>
						<tr>
							<th>※メールアドレス</th>
							<td>
								<input type="text" name="email" class="text" value="{{ $forms.email|escape }}" maxlangth="200" />{{ $err.email }}
							</td>
						</tr>

						<tr>
							<th>備考</th>
							<td>
								<textarea name="memo" class="textarea"  style="width:380px" />{{ $forms.memo|escape }}</textarea>{{ $err.memo }}
							</td>
						</tr>
{{ if $forms.id != '' }}
						<tr>
							<th>状態</th>
							<td style = "vertical-align:middle">
 {{ if $forms.login_ng == '1' }}
								<label><input class="chkinput" type="checkbox" name="login_ng" value="1" checked /> ログイン不可</label>
 {{ else }}
								<label><input class="chkinput" type="checkbox" name="login_ng" value="1"  /> ログイン不可</label>
 {{ /if }}
							</td>
						</tr>
 {{ /if }}
					</tbody>
				</table>
				<p class="button">
{{ if $forms.id != '' }}
					<button type="button" class="btn_return" class="submit"><span>戻る</span></button>
					<button type="button" class="btn_update" class="submit"><span>更新</span></button>
{{ else }}
					<button type="button" class="btn_regist" class="submit"><span>登録</span></button>
{{ /if }}
				</p>
				<input type="hidden" name="id" value="{{ $forms.id }}" />
				<input type="hidden" name="mode" value="" />
			</form>
{{ /if }}

{{ if $phase == 'complete' }}
			<p class="message">{{ $message }}</p>
			<ul>
{{ if $forms.id != '' }}
				<li>>> <a href="user_index.php?hist=2">一覧ページに戻る</a></li>
{{ else }}
				<li>>> <a href="user_index.php">一覧ページに戻る</a></li>
{{ /if }}
				<li>>> <a href="user_form.php">新規登録</a></li>
{{ if $forms.id != '' }}
				<li>>> <a href="user_form.php?id={{ $forms.id }}">更新</a></li>
{{ /if }}
			</ul>
{{ /if }}

		</div></div>
		{{ $footer }}
	</body>
</html>